package com.company.dcm.server.protocol.enums;

import lombok.Getter;

@Getter
public enum DowntimeReasonEnum {
    //相应的停机指令
    MANUALSHUTDOWN("手动停机",0),//手动停机
    DEFECTIVESHUTDOWN("瑕疵停机",1)
    ;


    private final String text;
    private final int value;


    DowntimeReasonEnum(String text,int value){
        this.text = text;
        this.value = value;
    }

    /**
     * 根据value获取枚举值
     * @param value
     * @return
     */
    public static String getEnumByValue(int value){
        for (DowntimeReasonEnum anEnum : DowntimeReasonEnum.values())
            if (anEnum.value == value){
                return anEnum.getText();
            }
        return null;
    }

}
